Skip to content

Add title and icons fields to client types#15

Merged
0xeb merged 13 commits intomainfrom
feature/proxy-title-icons
Dec 3, 2025
Merged

Add title and icons fields to client types#15
0xeb merged 13 commits intomainfrom
feature/proxy-title-icons

Conversation

@0xeb
Copy link
Copy Markdown
Owner

@0xeb 0xeb commented Dec 2, 2025

Summary

  • Add title and icons fields to client types: ToolInfo, ResourceInfo, ResourceTemplate, PromptInfo
  • Add JSON serialization/deserialization for new fields
  • Add to_json/from_json for ResourceTemplate (was missing)
  • Add comprehensive test coverage for title/icons serialization

Changes

  • include/fastmcpp/client/types.hpp - Add optional title and icons fields to 4 structs
  • tests/client/test_helpers.hpp - Add helper function for C++17 compatible struct initialization
  • tests/json_types.cpp - Add 6 test functions for serialization

Test plan

  • All 45 unit and integration tests pass
  • New serialization tests verify round-trip for title/icons
  • Backward compatible - fields are optional

- Add `title` and `icons` fields to client types: ToolInfo, ResourceInfo,
  ResourceTemplate, PromptInfo
- Add JSON serialization/deserialization for new fields
- Add `to_json`/`from_json` for ResourceTemplate (was missing)
- Add comprehensive unit tests for title/icons serialization
- Add integration tests (api_icons.cpp) for round-trip verification:
  - Tools with icons from server to client
  - Resources with icons
  - Resource templates with icons
  - Prompts with icons
@0xeb 0xeb force-pushed the feature/proxy-title-icons branch from 560fd81 to 926daf7 Compare December 2, 2025 20:40
0xeb added 5 commits December 2, 2025 13:01
- Add optional title, description, icons fields to tools::Tool
- Add builder pattern setters (set_title, set_description, set_icons)
- Update MCP handler to serialize icons in tools/list response
- Enables servers to expose icon metadata matching Python fastmcp
- Remove duplicate Transfer-Encoding header in sse_server.cpp
  (set_chunked_content_provider already sets it)
- Fix make_mcp_handler(server, tools, descriptions) to keep ToolManager
  access for tools/call invocation
- Include title/description/icons from Tool in tools/list response

T1 interop (C++ server + Python client) now passes 18/25 tests.
Remaining failures are resources/prompts which are documented as
not yet implemented.
Add SSE client transport to connect C++ clients to Python fastmcp servers:
- SseClientTransport class with SSE event stream listener
- JSON-RPC request/response matching with promise/future
- Handle CRLF line endings in SSE responses (Windows/HTTP)
- Properly unwrap JSON-RPC response envelope
- Handle single object content in prompt responses (fastmcp format)
- MCP initialization handshake before tool calls
- Implement resources/list and resources/read methods in McpHandler
- Implement prompts/list and prompts/get methods in McpHandler
- Add ResourceContent struct with text/binary variant for resource data
- Add provider functions for lazy resource content generation
- Add PromptArgument struct for prompt parameter definitions
- Add PromptMessage struct for MCP prompt responses
- Update Resource struct format with explicit fields (uri, name, id, kind, metadata)
- Add base64 encoding for binary resources in MCP responses
- Update test files to use new Resource API format

T1 interop tests pass 21/25 (84%) - core functionality working
Strip trailing slashes from resource URIs for compatibility with Python
fastmcp client which may append trailing slashes to URIs.
@0xeb 0xeb force-pushed the feature/proxy-title-icons branch from 3b53351 to 1087e71 Compare December 3, 2025 18:30
0xeb added 7 commits December 3, 2025 10:32
Update context_introspection.cpp and tool_injection_middleware.cpp to use
explicit field assignment instead of aggregate initialization, as the
Resource struct field order has changed.
PromptManager::get() now throws NotFoundError, update the test to match.
- PromptManager::add() now properly sets stored.name before storing
- Updated api_basic.cpp to expect 4 resources (includes icon resource)
- Updated api_advanced.cpp to expect 3 resource templates
- Added icon_tool to test mock for client_api_icons tests
- Add title and icons parsing to parse_list_resource_templates_result()
- Update api_basic.cpp test assertions for 7 tools (after icon_tool addition)
Update prompt count expectation from 2 to 3 to account for icon_prompt
@0xeb 0xeb merged commit 6fbc48c into main Dec 3, 2025
9 checks passed
@0xeb 0xeb deleted the feature/proxy-title-icons branch December 5, 2025 21:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant